gen parent_child_tot = parent_child_away+parent_child_home

*Fill in with previous observation
forvalues t= 1/4 {
	replace parent_child_tot =l`t'.parent_child_tot if year==1969+`t' | year==1974+`t' | year==1979+`t' | year==1984+`t' | year==1989+`t'
}

*Adjust birth order when it is below reported value
*egg 9 17 made some modifications here
rename birth_order birth_order0
gen birth_order = birth_order0
replace birth_order = parent_child_tot+1 if  i_obstaxyr==0 & year==taxyr_cut & parent_child_tot+1>birth_order0 & parent_child_tot~=.
replace birth_order = parent_child_tot if  i_obstaxyr==1 & year==taxyr_cut & belowcut==1 & parent_child_tot>birth_order0 & parent_child_tot~=.
replace birth_order = parent_child_tot+1 if  i_obstaxyr==1 & year==taxyr_cut & belowcut==0 & parent_child_tot+1>birth_order0 & parent_child_tot~=.
